/**
 * Created by JLB1 on 2017/1/20.
 */
import React, { Component, PropTypes } from 'react'
import ReactDOM from "react-dom"
import Tools from "../../lib/tools"
import { addErrorListener } from "../../lib/handleError"
import weixinShare from "../../lib/weixinShare"
import AJAX from "../../lib/ajax"
require('../../lib/rem')
require('../../styles/common.less');
require('../../styles/resetWeui.less');
require('../../styles/lux.less')
require('./BindPhoneSuccess.less');

class BindPhoneSuccess extends Component {
    constructor(props) {
        super(props)
        this.state = {
            wx_type: window.localStorage.getItem('wx_type'),
        }
    }

    componentWillMount() {
        addErrorListener()()
        weixinShare.hideAll()
    }

    componentDidMount() {
        AJAX.appendBaiduAnalysis()
    }

    render() {
        let phone = Tools.getParams().phone || '';
        let phoneShow = phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
        const { wx_type } = this.state;

        return (
            <div>
                <div className="bindSuccessBox">
                    <div className="bindSuccessMain">
                        <div>
                            <i className="iconfont icon-duigou bindSuccessIcon" />
                        </div>
                        <div>
                            <p className="success"> 恭喜您，绑定成功！</p>
                            <p className="bindPhone">已绑定手机号 <span>{phoneShow}</span></p>
                        </div>
                    </div>
                </div>
                <div className="handleBtnGroup">
                    <a href={`./PickUp?wx_type=${wx_type}`} className="weui-btn weui-btn_yellow">立即取件</a>
                </div>
            </div>
        )
    }
}
ReactDOM.render(<BindPhoneSuccess />, document.getElementById('app'));
if (module.hot) {
    module.hot.accept();
}

